From: Florian Eckert Date: Mon, 12 Dec 2022 13:58:38 +0000 (+0100) Subject: luci-base: fix button handling for named sections X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22/%22https:/collectd.org/%22?a=commitdiff_plain;h=440a2e79a762b4152ccb7e41c90a2826d9fb3538;p=project%2Fluci.git luci-base: fix button handling for named sections If more than one named section is added to the page, it is currently the case, that the first button is always switched on or off during input validation of the uci section name. This is because the usage of the 'document.querySelector' function is to imprecise. Changing the search start to the element to be created, fixes this. Signed-off-by: Florian Eckert --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 2d540420bc..3c538b88ca 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2259,7 +2259,7 @@ var CBITypedSection = CBIAbstractSection.extend(/** @lends LuCI.form.TypedSectio if (this.map.readonly !== true) { ui.addValidator(nameEl, 'uciname', true, function(v) { - var button = document.querySelector('.cbi-section-create > .cbi-button-add'); + var button = createEl.querySelector('.cbi-section-create > .cbi-button-add'); if (v !== '') { button.disabled = null; return true;